import request from '@/utils/request';

export function getAllEvents() {
    return request({
        url: '/events/getAllEvents',
        method: 'get'
    });
}

export function getCurrentEvents() {
    return request({
        url: '/events/getCurrentEvents',
        method: 'get'
    });
}

export function getHistoryEvents() {
    return request({
        url: '/events/getHistoryEvents',
        method: 'get'
    });
}

export function addNewEvent(eventData) {
    return request({
        url: '/events/add',
        method: 'post',
        data: eventData
    });
}

export function updateEvent(event_id, updatedData) {
    return request({
        url: `/events/update`,
        method: 'put',
        data: { event_id, ...updatedData }
    });
}


export function signUpForEvent(accessToken, id) {
    return request({
        url: '/events/signUp',
        method: 'post',
        headers: {
            Authorization: `Bearer ${accessToken}`
        },
        data: { id }
    });
}

export function getSignUpsByEventId(event_id) {
    return request({
        url: `/events/getSignUpsByEventId/${event_id}`,
        method: 'get'
    });
}
